//
//  MZRecommendPushCollectionReusableView.m
//  OurTourism
//
//  Created by 孟镇 on 15/11/26.
//  Copyright © 2015年 Devil_Coming. All rights reserved.
//

#import "MZRecommendPushCollectionReusableView.h"
#import "Header.h"

#define SWIDTH self.frame.size.width
#define SHEIGHT self.frame.size.height
@interface MZRecommendPushCollectionReusableView ()

@property (nonatomic, retain)UILabel *labelSep;
@property (nonatomic, retain)UILabel *labelNotes;
@property (nonatomic, retain)UILabel *label;
@property (nonatomic, retain)UILabel *labelPoint;
@property (nonatomic, retain)UILabel *labelImpresion;
@property (nonatomic, retain)UILabel *label1;
@property (nonatomic, retain)UILabel *labelPoint1;
@property (nonatomic, retain)UILabel *labelLeftSep;
@property (nonatomic, retain)UILabel *centerLabel;

@end

@implementation MZRecommendPushCollectionReusableView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
    
        self.btnNotes = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.btnNotes setBackgroundImage:[UIImage imageNamed:@"star"] forState:UIControlStateNormal];
        [self addSubview:self.btnNotes];
        
        self.labelNotes = [[UILabel alloc]init];
        self.labelNotes.text = @"精品游记";
        self.labelNotes.textAlignment = NSTextAlignmentCenter;
        self.labelNotes.textColor = [UIColor darkGrayColor];
        self.labelNotes.font = [UIFont systemFontOfSize:12];
        [self.btnNotes addSubview:self.labelNotes];
        
        self.centerLabel = [[UILabel alloc]init];
        self.centerLabel.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.centerLabel];
        
        self.labelSep = [[UILabel alloc]init];
        self.labelSep.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.labelSep];
        
        self.labelLeftSep = [[UILabel alloc]init];
        self.labelLeftSep.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.labelLeftSep];
        
        self.label = [[UILabel alloc]init];
        self.label.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.label];
        
        self.labelPoint = [[UILabel alloc]init];
        self.labelPoint.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.labelPoint];
        self.labelPoint.layer.masksToBounds = YES;
        self.labelPoint.layer.cornerRadius = 2.5;
        
        self.labelImpresion = [[UILabel alloc]init];
        self.labelImpresion.text = @"推荐地点";
        self.labelImpresion.font = [UIFont systemFontOfSize:15];
        self.labelImpresion.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelImpresion];
        
        self.labelPoint1 = [[UILabel alloc]init];
        self.labelPoint1.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.labelPoint1];
        self.labelPoint1.layer.masksToBounds = YES;
        self.labelPoint1.layer.cornerRadius = 2.5;
        
        self.label1 = [[UILabel alloc]init];
        self.label1.backgroundColor = [UIColor colorWithRed:0.74 green:0.72 blue:0.59 alpha:1];
        [self addSubview:self.label1];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    
    /* 精品游记*/
    [self.btnNotes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(10);
        make.left.mas_equalTo(self).offset(SWIDTH / 2 - 17.5);
        make.size.mas_equalTo(CGSizeMake(35, 35));
    }];
    
    [self.labelNotes mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.btnNotes).offset(20);
        make.left.mas_equalTo(self).offset(SWIDTH / 2 - 30);
        make.size.mas_equalTo(CGSizeMake(60, 20));
    }];
    
    //中间的线
    [self.labelLeftSep mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(10);
        make.left.mas_equalTo(self.btnNotes).offset(-30);
        make.size.mas_equalTo(CGSizeMake(1, 50));
    }];
    [self.centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(10);
        make.right.mas_equalTo(self.btnNotes).offset(30);
        make.size.mas_equalTo(CGSizeMake(1, 50));
    }];
    
    //分割线
    [self.labelSep mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.btnNotes).offset(30);
        make.left.mas_equalTo(self).offset(20);
        make.size.mas_equalTo(CGSizeMake(WIDTH - 40, 1));
    }];
    
    [self.labelImpresion mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.labelLeftSep).offset(50);
        make.left.mas_equalTo(self).offset(WIDTH / 2 - 40);
        make.size.mas_equalTo(CGSizeMake(80, 20));
    }];
    
    [self.labelPoint mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.labelSep).offset(27);
        make.left.mas_equalTo(self.labelImpresion).offset(80);
        make.size.mas_equalTo(CGSizeMake(5, 5));
    }];
    
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.labelSep).offset(25);
        make.left.mas_equalTo(self.labelImpresion).offset(87);
        make.size.mas_equalTo(CGSizeMake(WIDTH / 4, 1));
    }];
    
    [self.labelPoint1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.labelSep).offset(27);
        make.right.mas_equalTo(self.labelImpresion).offset(-80);
        make.size.mas_equalTo(CGSizeMake(5, 5));
    }];
    
    [self.label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.labelSep).offset(25);
        make.right.mas_equalTo(self.labelImpresion).offset(-87);
        make.size.mas_equalTo(CGSizeMake(WIDTH / 4, 1));
    }];
    
}


@end
